package javaUtils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtils {
	
	public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
	public static final String DF_MM_YYYY = "MM - yyyy";
	public static final String DF_YYYY = "yyyy";
	public static final String DF_MM = "MM";
	public static final String DF_DD = "dd";
	public static final DateFormat df = new SimpleDateFormat(DATE_FORMAT_NOW);
	
	public static String getDateTime() {
	    Calendar cal = Calendar.getInstance();
	    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
	    return sdf.format(cal.getTime());

	  }

	public static String getDateFrom(Date dt){
		
		SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
	    return sdf.format(dt.getTime());
		
	}
	
	public static String getDateNow(String format){
		Calendar cal = Calendar.getInstance();
	    SimpleDateFormat sdf = new SimpleDateFormat(format);
	    return sdf.format(cal.getTime());
	}
	public static String getDateNow(String format,Calendar date){
	    SimpleDateFormat sdf = new SimpleDateFormat(format);
	    return sdf.format(date.getTime());
	}
}
